# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Contributor: Storm Dragon <stormdragon2976@gmail.com>

pkgname=python-txtorcon
pkgver=22.0.0
pkgrel=2
pkgdesc='A Twisted-based Python asynchronous controller library for Tor'
arch=('any')
url='https://txtorcon.readthedocs.org/'
license=('MIT')
depends=('python-automat' 'python-twisted')
makedepends=('python-setuptools')
checkdepends=('python-mock' 'python-cryptography' 'python-pyopenssl' 'lsof')
source=("${pkgname#python-}-${pkgver}.tar.gz::https://github.com/meejah/txtorcon/releases/download/v${pkgver}/txtorcon-${pkgver}.tar.gz"
        "${pkgname#python-}-${pkgver}.tar.gz.asc::https://github.com/meejah/txtorcon/releases/download/v${pkgver}/txtorcon-${pkgver}.tar.gz.asc")
sha512sums=('545be2ceddec813dd56c9889d8e6d787873cd49cc179178ae6aa8c8407dcdcd9c5b60bfcb3f432efc52f876f88071cea610f3e4cebde0beec7610b009168e60a'
            'SKIP')
validpgpkeys=('9D5A2BD5688ECB889DEBCD3FC2602803128069A7')

build() {
	cd "${pkgname#python-}-${pkgver}"
	python setup.py build
}

check() {
	cd "${pkgname#python-}-${pkgver}"
	PYTHONPATH=. trial test
}

package() {
	cd "${pkgname#python-}-$pkgver"
	python setup.py install --root="$pkgdir/" --optimize=1 --skip-build
	rm -r "${pkgdir}/usr/share/txtorcon"
	install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
